package com.jiazhong.basic.shuxin.design.单例模式;

import lombok.SneakyThrows;

// 单例模式:懒加载单例模式 多线程情况下有可能会出现多个对象
public class DemoB {

    private static DemoB instance;

    private DemoB() {
    }

    @SneakyThrows
    public static DemoB getInstance() {
        if (instance == null) {
            Thread.sleep(1000);
            instance = new DemoB();
        }
        return instance;
    }
}
